# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=themole
pkgver=0.3
pkgrel=11
groups=('blackarch' 'blackarch-webapp')
pkgdesc='Automatic SQL injection exploitation tool.'
arch=('any')
url='http://sourceforge.net/projects/themole/'
license=('GPL3')
depends=('python3' 'python-lxml')
source=("http://downloads.sourceforge.net/project/$pkgname/$pkgname-$pkgver/$pkgname-$pkgver-lin-src.tar.gz")
sha512sums=('14ccfb90a3b8e9a2f14016a4a572851eb57e55f9140c1cb07ff3fe34514c8c4e3cafdb3a126bf91afacd42a656cb97a897e5e78304e7a62ea5cd81bd446d1c3f')

prepare() {
  cd "$pkgname-$pkgver"

  sed -i 's/python3/python/' *.py
}

package() {
  cd "$pkgname-$pkgver"

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
exec python3 /usr/share/$pkgname/mole.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

